using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace DataStructure
{
    public class MaxPQ<T> : IQueue<T> where T : IComparable<T>
    {
        private MaxHeap<T> heap;
        public int Count => heap.Count;

        public bool IsEmpty => heap.IsEmpty;

        public MaxPQ(int capacity)
        {
            heap = new MaxHeap<T>(capacity);
        }
        
        public MaxPQ()
        {
            heap = new MaxHeap<T>();
        }
        
        public T Dequeue()
        {
            return heap.RemoveMax();
        }

        public void Enqueue(T data)
        {
            heap.Insert(data);
        }

        public T Peek()
        {
            return heap.Max();
        }

        public override string ToString()
        {
            return heap.ToString();
        }
    }
}